package net.jlibrary.computer.domain;

import com.alipay.api.domain.PreCreateWaybillIstd;
import net.jlibrary.common.core.annotation.CodeGenComment;
import net.jlibrary.common.core.annotation.Compositor;
import net.jlibrary.common.core.annotation.SearchCondition;
import net.jlibrary.common.core.annotation.SearchField;
import net.jlibrary.common.core.entity.BaseObject;
import net.jlibrary.student.domain.Specialty;
import org.springframework.stereotype.Component;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Entity(name = "t_computer_types")
@Component
@Compositor("createdate desc")
@CodeGenComment(value = "电脑类型", genSelect = true)
public class ComputerType extends BaseObject {


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @SearchField(value = "id", condition = SearchCondition.EQUAL)
    private Long id;
    private String name;

    @Transient
    @SearchField(value = "name", condition = SearchCondition.FUZZ_RIGHT)
    private String nameSearchKey;

    @Column(updatable = false)
    @Temporal(TemporalType.TIMESTAMP)
    @CodeGenComment(value = "创建时间", viewList = true)
    private Date createdate;
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastdate;

    public Long getId() {
        return id;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Specialty other = (Specialty) obj;
        if (id == null) {
            if (other.getId() != null)
                return false;
        } else if (!id.equals(other.getId()))
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNameSearchKey() {
        return nameSearchKey;
    }

    public void setNameSearchKey(String nameSearchKey) {
        this.nameSearchKey = nameSearchKey;
    }

    public ComputerType() {

    }


    @Override
    public Serializable getPrimaryKey() {
        return id;
    }

    @Override
    public Date getCreatedate() {
        return createdate;
    }

    @Override
    public Date getLastdate() {
        return lastdate;
    }

    @Override
    public void setCreatedate(Date createdate) {
        this.createdate = createdate;
    }

    @Override
    public void setLastdate(Date lastdate) {
        this.lastdate = lastdate;
    }

}
